package com.dinzeer.sjapadder.effect;

import com.dinzeer.sjapadder.register.SjaEffect;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber
public class Tranquility  extends MobEffect {
    public Tranquility() {
        super(MobEffectCategory.BENEFICIAL, -26368);
    }
    @SubscribeEvent
    public static void LivingHurt(LivingHurtEvent event){
                if (event.getEntity().hasEffect(SjaEffect.Tranquility.get())){
                    event.setAmount((float) (event.getAmount()*
                            (1-(event.getEntity().getEffect(SjaEffect.Tranquility.get()).getAmplifier()*0.15))
                            )
                    );
                }
    }
}
